﻿@model List<CMSApplication.Areas.Administration.Models.CustomerModel>
<script>
    jQuery(document).ready(function ($) {
        $("#ListTable").dataTable({
            "sPaginationType": "full_numbers",
            "iDisplayLength": 5,
            "bSortable": false,
            "aLengthMenu": [5, 10, 20],
        });

        $("#ListTable").on("dblclick", "tbody tr", function () {
            var tr = $(this).closest("tr");
            var item = {
                Id: parseInt(tr.find(".Id").html()),
                Name: tr.find(".Name").html(),
                Phone: tr.find(".Phone").html(),
                Addr: tr.find(".Addr").html()
            };
            UpdCustomerInfo(item);
            $.fancybox.close();
        });
    });
</script>
<table class="table dataTable" style="width: 100%" id="ListTable">
    <thead>
        <th style="text-align:center;">Mã</th>
        <th>Tên</th>
        <th>Địa chỉ</th>
        <th>Điện thoại</th>
        <th>Loại</th>
        <th style="text-align:center;">Ngày tạo</th>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td style="text-align:center;">
                    <span class="Id">@item.Id</span>
                </td>
                <td>
                    <span class="Name">@item.Name</span>
                </td>
                <td>
                    <span class="Addr">@item.Addr</span>
                </td>
                <td>
                    <span class="Phone">@item.Phone</span>
                </td>
                <td>
                    <span>@item.TypeName</span>
                </td>
                <td style="text-align:center;">
                    <span>@string.Format("{0:dd/MM/yyyy}", item.CreatedOn)</span>
                </td>
            </tr>
        }
    </tbody>
</table>
